package com.example.demo.mvvm.utils;


import com.example.demo.mvvm.ui.base.BaseActivity;
import com.tbruyelle.rxpermissions2.RxPermissions;

import java.util.function.Consumer;

/**
 * Created by 80711 on 2018/5/9.
 */

public class PremissionUtils {

    public static void requestPermissions(final BaseActivity.PermissionCallBack callBack , String... prams){
        RxPermissions rxPermissions = new RxPermissions(ActivityUtils.peek());
        rxPermissions.request(prams).subscribe(new io.reactivex.functions.Consumer<Boolean>() {
            @Override
            public void accept(Boolean aBoolean) throws Exception {
                callBack.result(aBoolean);

            }
        });

    }

    public interface PermissionCallBack{
        void result(boolean flag);
    }

}
